if (!jsx3.lang.Class.forName("ux.cdb.admin.mechanism.cooOrg.CooOrgInvest.builder.CooOrgEditLinkman")) {

    /**
     * Define the <code>name of class</code> class.
     * This class inherit from <code>jsx3.gui.Block<code> GUI class.
     */	
    jsx3.Class.defineClass("ux.cdb.admin.mechanism.cooOrg.CooOrgInvest.builder.CooOrgEditLinkman", ux.megatron.gui.WizardPanel, null, function(objRoot){
        objRoot.prototype.btnAdd = null; //add button
        objRoot.prototype.btnEdit = null; //edit button
        objRoot.prototype.btnDelete = null; //delete button
        objRoot.prototype.matrix = null;//matrix
        objRoot.prototype.canEdit = false;//whether the record can edit
        objRoot.prototype.blkExpend = null;//the panel which contain the buttons "save&cancel"
        objRoot.prototype.initRecords=null;//save the content befor edit
        /*
         * This method will be called after UI file has deserialized.
         */
        objRoot.prototype.onAfterDeserialize = function(){
        	

			
        }
        objRoot.prototype.ruleChecked = function(){
        	if (this.matrix.getCheckedNodes().size()>0)
			{
				this.btnDelete.setEnabled(jsx3.gui.Form.STATEENABLED, true);
			}
			else
			{
				this.btnDelete.setEnabled(jsx3.gui.Form.STATEDISABLED, true);
			}
		}
		objRoot.prototype.onAdd = function(){
			//user click add button 
			//enter the add mode
			this.canEdit=true;
			//save the records for revert
			this.initRecords=this.matrix.getXML().cloneDocument();
			//insert a new record
			var record=this.matrix.insertRecord({jsxid:jsx3.xml.CDF.getKey()},null,false);
			this.matrix.repaintData();
			//show save&canel button
			this.blkExpend.setDisplay(jsx3.gui.Block.DISPLAYBLOCK,true);
		}

		objRoot.prototype.onEdit = function(){
			if (this.canEdit == false) {//if current not eidt mode, then change the statue to edit mode
				this.canEdit = true;
				//save the records for revert
				this.initRecords=this.matrix.getXML().cloneDocument();
				this.blkExpend.setDisplay(jsx3.gui.Block.DISPLAYBLOCK, true);
			}
		}
		objRoot.prototype.onDelete= function(){
			var server=ux.megatron.Main.getServer();
			if (this.canEdit)
			{
				server.confirm(server.getDynamicProperty("@cdb@Mechanism@CooOrg@AlertTitle"),server.getDynamicProperty("@cdb@Mechanism@CooOrg@CancelEdit"),this.callDeleteRecord,null);
			}
		}
		objRoot.prototype.callDeleteRecord=function(objEvent)
		{//call service to delete the selected record
			objEvent.doClose();//close the confirm window
			if (this.canEdit) {
			//cancel the edit
			//revert the record
			
			}
		}
		objRoot.prototype.onSave = function(){
			//here to save
			
			//out the edit mode
			this.canEdit=false;
			//hidde the button save&cancel
			this.blkExpend.setDisplay(jsx3.gui.Block.DISPLAYNONE, true);
		}
		objRoot.prototype.onLinkmanCancel = function(){
			//here to cancel
			//out the edit mode
			//rever the data
			this.matrix.getXML().loadXML(this.initRecords.toString());
			this.matrix.repaintData();
			//hidde the button save&cancel
			this.blkExpend.setDisplay(jsx3.gui.Block.DISPLAYNONE, true);
			this.canEdit=false;
		}
		objRoot.prototype.getCanEdit = function(){
			return this.canEdit;
		}
		objRoot.prototype.init = function(strName, vntLeft, vntTop, vntWidth, vntHeight, strHTML) {
	
			//call constructor for super class (the super expects the name of the object and the function that it is an instance of)
			this.jsxsuper(strName, vntLeft, vntTop, vntWidth, vntHeight, strHTML);
		};

		objRoot.prototype.initialize = function(msg) {
			//this.wizard = this.getAncestorOfType("ux.megatron.gui.SteppedWizard");
			var me=this;
            this.btnAdd = this.getDescendantOfName("btn_Linkman_add");
            this.btnEdit = this.getDescendantOfName("btn_Linkman_edit");
            this.btnDelete = this.getDescendantOfName("btn_Linkman_delete");
            this.blkExpend=this.getDescendantOfName("blkExpend");
			this.matrix=this.getDescendantOfName("mtxEditLinkman");
			this.matrix.subscribe(ux.cdb.admin.gui.Matrix.EVENT_CHECKALL, me, me.ruleChecked);
		}

		objRoot.prototype.onNext = function(objWIZARD, objBUTTON, objEVENT, strCURRENTPANEL) {
			return null; // return "NONE" to not next panels
		}

		objRoot.prototype.onPrev = function(objWIZARD, objBUTTON, objEVENT, strCURRENTPANEL) {
			return null; // return "NONE" to not advance panels
		}

		objRoot.prototype.onRevert = function(objWIZARD, objBUTTON, objEVENT, strCURRENTPANEL) {
			return null; // return "NONE" to not last status
		}

		objRoot.prototype.onCancel = function(objWIZARD, objBUTTON, objEVENT, strCURRENTPANEL) {
			this.getAncestorOfType("ux.cdb.admin.mechanism.cooOrg.CooOrgWizard").onClose();
			return null; // return "NONE" to not advance panels
		}

		objRoot.prototype.onCustomNav = function(objWIZARD, objBUTTON, objEVENT, strCURRENTPANEL) {
			return null; // return "NONE" to not advance panels
		}

		objRoot.prototype.onBeforeShow = function(objWIZARD, objBUTTON, objEVENT, strLASTPANEL) {
			if(!this.getChild(0)) {
				var me = this;
				ux.megatron.Main.loadUIResourceAsync(me, "ux.cdb.admin","ux/cdb/admin/mechanism/cooOrg/CooOrgInvest/builder/step3/ui/CooOrg_Edit_LinkmanContent.xml", me, me.initialize);
			}
			return null; // return "NONE" to not advance panels
		}

		objRoot.prototype.onAfterHide = function(objWIZARD, objBUTTON, objEVENT, strNEXTPANEL) {
			return null; // return "NONE" to not advance panels
		}
    });
}
